package com.zhichat.infrastructure.Enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @ClassName: UserStatusEnum
 * @Description: 用户状态enum
 * @Author: 团长九哥 https://space.bilibili.com/602197686
 * @CreateDate: 2024/11/16 20:51
 */
@Getter
@AllArgsConstructor
public enum UserStatusEnum {
    NORMAL(1, "禁用"),
    DISABLED(2, "正常");
    private final Integer code;
    private final String desc;

    public static UserStatusEnum getEnumByCode(Integer code) {
        for (UserStatusEnum userStatusEnum : UserStatusEnum.values()) {
            if (Objects.equals(userStatusEnum.getCode(), code)) {
                return userStatusEnum;
            }
        }
        return null;
    }
}
